package org.example.day13;

/**
 * 7.1.3 验证WAITING
 */
public class MyThread4 extends Thread{
    @Override
    public void run() {
        try {
            synchronized (Lock.lock){
                Lock.lock.wait();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        try {
            MyThread4 t = new MyThread4();
            t.start();
            Thread.sleep(1000);
            //main方法中的状态: WAITING
            System.out.println("main方法中的状态: " + t.getState());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

class Lock{
    public static final Byte lock = new Byte("0");
}